<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>

</body>
<script>
    // 用最简洁代码实现 indexOf 方法
    function indexOf(str, a, start) {
        start = start == undefined ? 0 : start;
        for (var i = start; i < str.length; i++) {
            if (str[i] == a) {
                return i;
            }
        }
        return -1;
    }

    
</script>

</html>